#ifndef _CANVASGL_H
#define _CANVASGL_H

#include <wx/wx.h>
#include <GL/glew.h>
#include <wx/glcanvas.h>

// CanvasGL - repr�sentiert eine OpenGL Zeichenfl�che in der wxWindows API.
class CanvasGL : public wxGLCanvas {
  public:
    CanvasGL(wxWindow *parent, wxWindowID id);

  protected:
    int getWidth() const;
    int getHeight() const;
    GLuint loadTexture(const wxString &fileName);

    virtual void initCallback() { }
    virtual void resizeCallback() { }
    virtual void drawCallback() { }
    virtual void buttonPressCallback(int x, int y, int button) { }
    virtual void buttonReleaseCallback(int x, int y, int button) { }
    virtual void motionCallback(int x, int y, int dx, int dy, int button) { }

  private:
    static int _attribList[];
    int _oldMouseX, _oldMouseY;
    bool _bGLInitialized;

    void onSize(wxSizeEvent &event);
    void onEraseBackground(wxEraseEvent &event);
    void onPaint(wxPaintEvent &event);
    void onMouseEvents(wxMouseEvent &event);

    DECLARE_EVENT_TABLE()
};

#endif // _CANVASGL_H_
